cmake_minimum_required(VERSION 2.6)

project(QOgre)


FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTMAIN TRUE)
INCLUDE(${QT_USE_FILE})

if(MINGW)
   set(CMAKE_RC_COMPILER_INIT windres)
   ENABLE_LANGUAGE(RC)
   SET(CMAKE_RC_COMPILE_OBJECT
     "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif(MINGW)

set( HDRS
		include/InitOgre.h
		include/MainWindow.h
		include/OgreView.h
		include/ogrewidget.hxx
		include/Scene.h
		include/MovableText.h
		include/ViewportGrid.h
		include/SdkCameraMan.h
		
	)

set( SRCS
		src/main.cpp
		src/MainWindow.cpp
		src/OgreView.cpp
		src/ogrewidget.cpp
		src/Scene.cpp
		src/MovableText.cpp
		src/ViewportGrid.cpp
	)

SET(PROJECT_SRCS ${SRCS})
SET(PROJECT_MOC_SRCS include/MainWindow.h include/ogrewidget.hxx)

QT4_WRAP_CPP(PROJECT_MOCS ${PROJECT_MOC_SRCS})
#QT4_ADD_RESOURCES(PROJECT_RCC_SRCS main.qrc)

SET(PROJECT_SRCS 
	${PROJECT_SRCS} 
	${PROJECT_MOCS} 
#	${PROJECT_RCC_SRCS}
)





ADD_EXECUTABLE(QOgre WIN32 ${PROJECT_SRCS} ${HDRS} )



INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_BINARY_DIR}
	${OGRE_INCLUDE_DIRS}
	${OgreProcedural_SOURCE_DIR}/include
	${CMAKE_CURRENT_SOURCE_DIR}/include
	${OGRE_BOOST_INCLUDEPATH}
	${QT_INCLUDEPATH}
)
target_link_libraries(
		QOgre
		${QT_LIBRARIES}
		qtmaind.lib
		QtCored4.lib
		QtGuid4.lib
		OgreMain_d.lib
		libboost_thread-vc90-mt-gd-1_44.lib
		OgreProcedural_d.lib
		)
# if win32, copy the Ogre DLLs and media over
if(WIN32)
	OGRE_copy_release(cg.dll)	
	OGRE_copy_debug(cg.dll)
	
	OGRE_copy_release(OgreMain.dll)	
	OGRE_copy_debug(OgreMain_d.dll)
	
	OGRE_copy_release(OgrePaging.dll)	
	OGRE_copy_debug(OgrePaging_d.dll)

	OGRE_copy_release(OgreProperty.dll)	
	OGRE_copy_debug(OgreProperty_d.dll)

	OGRE_copy_release(OgreRTShaderSystem.dll)	
	OGRE_copy_debug(OgreRTShaderSystem_d.dll)

	OGRE_copy_release(Plugin_CgProgramManager.dll)	
	OGRE_copy_debug(Plugin_CgProgramManager_d.dll)


	OGRE_copy_release(Plugin_OctreeSceneManager.DLL)	
	OGRE_copy_debug(Plugin_OctreeSceneManager_d.DLL)

	OGRE_copy_release(RenderSystem_Direct3D9.dll)	
	OGRE_copy_debug(RenderSystem_Direct3D9_d.dll)
		
	OGRE_copy_release(RenderSystem_GL.dll)
	OGRE_copy_debug(RenderSystem_GL_d.dll)

	OGRE_copy_release(PLUGINS.CFG)
	OGRE_copy_debug(PLUGINS_D.CFG)

#	OGRE_copy_release(RESOURCES.CFG)
#	OGRE_copy_debug(RESOURCES_D.CFG)

	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_ParticleFX_d.DLL)

	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_CgProgramManager_d.DLL)

	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_PCZSceneManager_d.DLL)

	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_OctreeSceneManager_d.DLL)

	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_OctreeZone_d.dll)


	OGRE_copy_release(RESOURCES.CFG)
	OGRE_copy_debug(Plugin_BSPSceneManager_d.dll)

	QT_COPY_RELEASE(QtCore4.dll)
	QT_COPY_DEBUG(QtCoreD4.dll)

	QT_COPY_RELEASE(QtGui4.dll)
	QT_COPY_DEBUG(QtGuid4.dll)

#	copy_release_dir(resources.cfg ${PROCEDURAL_TEMPLATES_DIR})
#	copy_debug_dir(resources_d.cfg ${PROCEDURAL_TEMPLATES_DIR})
	
	
endif(WIN32)
create_vcproj_userfile(QOgre)